<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.jose.photogallery.domain.Photo" %>

<%
	User user = (User) request.getAttribute("user");
	Photo photo = (Photo) request.getAttribute("photo");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Share-a-Photo!</title>
		<link type="text/css" rel="stylesheet" href="/static/css/reset.css"  media="all" /> 
		<link type="text/css" rel="stylesheet" href="/static/css/main.css" media="all" />
	</head>
	<body>
		<!-- header -->
		<div id="header">
			<h1><a href="/">Share-a-Photo</a></h1>
			<div id="user-bar">
				<span id="login-name"><%= user.getNickname() %></span> <a href="/upload">Upload a photo</a> | <a href="<%=request.getAttribute("logoutUrl") %>">logout</a>
			</div>
		<!-- /header -->
		</div>
		
		<!-- content-wrap -->
		<div id="content-wrap">
			<!-- content -->
			<div id="content">
				<h1>Edit Photo</h1>
				
				<div id="img">
					<img src="<%= photo.getImageURLResize() %>" alt="" />
					<br /><span><%= photo.getCaption() %></span>
				</div>
				
				<form action="/edit" method="post">
					<fieldset class="uploadPhoto">
						<input type="hidden" name="key" value="<%= photo.getBlobKey() %>"/>
						<label for="caption">Caption:</label>
						<input type="text" name="caption" value="<%= photo.getCaption() %>"/><br/>
						<label for="description">Description:</label><br/>
						<textarea rows="5" cols="40" name="description"><%= photo.getDescription() %></textarea><br/>
						<label for="tag">Tags:</label>
						<input type="text" name="tags" value="<%= photo.getTagsString() %>" /><br/>
						<label for="privacy">Privacy:</label>
						<select name="privacy">
							<option value="public"
							<% if (photo.getPrivacy().equals("public")){ %>
								selected="selected"
							<% } %>
							>Public</option>
							<option value="internal"
							<% if (photo.getPrivacy().equals("internal")){ %>
								selected="selected"
							<% } %>
							>Only people with the link</option>
							<option value="private"
							<% if (photo.getPrivacy().equals("private")){ %>
								selected="selected"
							<% } %>
							>Only Me</option>
						</select><br/>
						<input type="submit"  value="submit"/>
					</fieldset>
				</form>
			<!-- /content -->
			</div>
			
		<!-- /content-wrap -->
		</div>
		
		<!-- footer -->
		<div id="footer">
			<p>Share-a-Photo | Powered by <a href="http://code.google.com/appengine/">Google App Engine</a></p>
		<!-- /footer -->
		</div>
	</body>
</html>